import request from '@/config/axios'
import type { ListType, ListDictType } from './type'
// 获取列表
export const getDataList = (params: any): Promise<LoginResponse<ListType>> => {
  return request.get({ url: `/sys/syssearchbar/list`, params })
}
//新增接口
export const dictAdd = (data: any): Promise<LoginResponse> => {
  return request.post({ url: `/sys/syssearchbar/add`, data })
}
// 编辑
export const dictEdit = (data: any): Promise<LoginResponse> => {
  return request.post({ url: `/sys/syssearchbar/edit`, data })
}
// 删除
export const dictDelete = (params: any): Promise<LoginResponse> => {
  return request.delete({ url: `/sys/syssearchbar/delete?id=${params}` })
}
//刷新缓存 /horizon-system/sys/dict/refleshCache
export const getRefleshCache = (): Promise<LoginResponse> => {
  return request.get({ url: '/sys/syssearchbar/refleshCache' })
}
// 子级列表
export const getDataDictList = (params: any): Promise<LoginResponse<ListDictType>> => {
  return request.get({ url: `/sys/syssearchbaritem/list`, params })
}
//子级添加 /horizon-system/sys/dictItem/add
export const dictItemAdd = (data: any): Promise<LoginResponse> => {
  return request.post({ url: `/sys/syssearchbaritem/add`, data })
}
// 获取字典
export const getLoadDict = (params: any): Promise<LoginResponse> => {
  return request.get({ url: `/sys/dict/getDictItemAll/${params}`})
}
//子级编辑 /horizon-system/sys/dictItem/edit
export const dictItemEdit = (data: any): Promise<LoginResponse> => {
  return request.post({ url: `/sys/syssearchbaritem/edit`, data })
}
// 子级删除
export const dictItemDelete = (params: any): Promise<LoginResponse> => {
  return request.delete({ url: `/sys/syssearchbaritem/delete?id=${params}` })
}



//导出 /horizon-system/sys/dict/exportXls
// export const dictExportXls = (): Promise<exportResponse> => {
//   const headers = {
//     'Content-Type': 'application/x-www-form-urlencoded'
//   }
//   return request.post({
//     url: `/sys/dict/exportXls`,
//     responseType: 'blob',
//     headers: headers
//   })
// }

